//
//  SWRequestKeyReq.swift
//  ChildStory
//
//  Created by linhan on 16/8/24.
//  Copyright © 2016年 Aiya. All rights reserved.
//

import Foundation
class SWRequestKeyFetchReq: SWBaseRequest
{
    override init()
    {
        super.init()
        options.authorize = false
        api = SWRequestAPI.RequestKeyFetch
    }
    
    override func onAPISuccessWithJSON(_ json:JSON, JSONString:String, JSONData:Data, cache:Bool)
    {
        if let key = json["data"]["request_code"].string , key != ""
        {
            onAPISuccess(key, cache:cache)
        }
        else
        {
            onAPIFailed(SWError.RequestKeyError)
        }
    }
}
